package com.ruoyi.admin.train.controller;

import java.util.List;


import com.ruoyi.train.domain.ExamPassCertificate;
import com.ruoyi.train.domain.Vo.ExamPassCertificateVo;
import com.ruoyi.train.service.IExamPassCertificateService;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 盖章Controller
 * 
 * @author wusihao
 * @date 2023-04-18
 */
@RestController
@RequestMapping("/exam/gaizhangCertificate")
public class gaizhangCertificateController extends BaseController
{
    @Autowired
    private IExamPassCertificateService examPassCertificateService;

    /**
     * 查询考试合格证明列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ExamPassCertificate examPassCertificate)
    {
        startPage();
        List<ExamPassCertificateVo> list = examPassCertificateService.gaizhangExamPassCertificateList(examPassCertificate);
        return getDataTable(list);
    }

    /**
     * 获取考试合格证明详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(examPassCertificateService.selectExamPassCertificateById(id));
    }

    /**
     * 新增考试合格证明
     */
    @Log(title = "考试合格证明", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ExamPassCertificate examPassCertificate)
    {
        return toAjax(examPassCertificateService.insertExamPassCertificate(examPassCertificate));
    }

    /**
     * 提交盖章，生成制证申请表
     */
    @Log(title = "考试合格证明", businessType = BusinessType.UPDATE)
    @GetMapping("/updateGaizhangCertificate/{certificateId}")
    public AjaxResult edit(@PathVariable Long certificateId)
    {
        return toAjax(examPassCertificateService.submitgaizhang1getCertificate(certificateId));
    }

    /**
     * 删除考试合格证明
     */
    @Log(title = "考试合格证明", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(examPassCertificateService.deleteExamPassCertificateByIds(ids));
    }

}
